﻿using OpenFileTransfer.Wpf.Tools;

namespace OpenFileTransfer.Wpf.Services
{
    /// <summary>
    /// 日志服务
    /// </summary>
    public class LogService : ILogService
    {
        /// <summary>
        /// 启动日志模块
        /// </summary>
        public void Startup(string info = @"Instance startup.")
        {
            LogHelper.Startup();
            if (!string.IsNullOrWhiteSpace(info))
            {
                LogHelper.Info(info);
            }
        }

        /// <summary>
        /// 关闭日志模块
        /// </summary>
        public void Shutdown(string info = @"Instance shutdown.")
        {
            if (!string.IsNullOrWhiteSpace(info))
            {
                LogHelper.Info(info);
            }

            LogHelper.Shutdown();
        }

        #region 添加日志

        public void Trace(string message)
        {
            LogHelper.Trace(message);
        }

        public void Debug(string message)
        {
            LogHelper.Debug(message);
        }

        public void Info(string message)
        {
            LogHelper.Info(message);
        }

        public void Warn(string message)
        {
            LogHelper.Warn(message);
        }

        public void Error(string message)
        {
            LogHelper.Error(message);
        }

        public void Fatal(string message)
        {
            LogHelper.Fatal(message);
        }

        #endregion
    }
}
